package cn.lidongyu.org.service.impl;

import cn.lidongyu.basic.PageList;
import cn.lidongyu.org.domain.Employee;
import cn.lidongyu.org.mapper.EmployeeMapper;
import cn.lidongyu.org.query.EmployeeQuery;
import cn.lidongyu.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public List<Employee> findAll() {
        return employeeMapper.findAll();
    }

    @Override
    public Employee findOne(Long id) {
        return employeeMapper.findOne(id);
    }

    @Override
    public void add(Employee department) {
        employeeMapper.add(department);

    }

    @Override
    public void delete(Long id) {
        employeeMapper.delete(id);

    }

    @Override
    public void update(Employee department) {
        employeeMapper.update(department);

    }

    @Override
    public Long findCount(EmployeeQuery employeeQuery) {
        return employeeMapper.findCount(employeeQuery);
    }

    @Override
    public PageList<Employee> findByQuery(EmployeeQuery employeeQuery) {
        Long count = employeeMapper.findCount(employeeQuery);
        List<Employee> query = employeeMapper.findByQuery(employeeQuery);
        PageList<Employee> departmentPageList = new PageList<>(count,query);



        return departmentPageList;
    }

    @Override
    public void deletemore(List<Long> ids) {
        employeeMapper.deletemore(ids);
    }
}
